package org.research.util;

import java.util.Comparator;

import org.hibernate.entity.Column;

public class ComparatorColumns implements Comparator<Column>{

	/**
	 * �Ȱ�menu_type ���� 
	 * �����ͬ��menu_code����
	 * �����ͬ��id����
	 */
	public int compare(Column o1, Column o2) {
		
		int intFlag = o1.getMenuType() - o2.getMenuType();
		if(intFlag == 0){
			intFlag = o1.getSortWay().compareTo(o2.getSortWay());
			if(intFlag == 0) {
				intFlag = (o1.getId()<o2.getId()?-1:1);
			}
		} else {
			intFlag = (intFlag < 0 ? -1 : 1);
		}
		return intFlag;
	}

}
